<?php
require_once 'data/users.php';
?>
<link rel="stylesheet" type="text/css" href="css/css.css">
<div class="kh">
<div class="login-form">
    <h1>
        Login
    </h1>
    Don't use web yes?
    <div class="noidung">
        <div class="login">
            <form id="login" action="index.php" method="post" >
           Account<input type="text" name="account"  id="account"><br>  
               Password   <input type="password" name="password" id="password"> 
               <br> 
                <a href="#" class="forgot">forgot password?</a><br>
                <input id="submit" type="submit" name='submit' value="Sign In">
            </form>
        </div>
        <div class="shadow"></div>


    </div>
</div></div>
<?php
if(isset($_POST["submit"])) {
    $flag = false;
    for ($i = 0; $i < count($users); $i++) {
        if (strcmp($_POST["username"], $users[$i]["username"]) == 0 && strcmp($_POST["password"], $users[$i]["password"]) == 0) {
            $flag = true;
        } else {
            $flag = false;
        }
    }
    if ($flag == true) {
        echo $_POST["username"] . " dang nhap thanh cong";
    
    header("Location: http://localhost:82/vthieu-web1/files.php".$users[$index]['id']);
    }else {
        echo $_POST["username"] .
        'loi dang nhap';
    }
}
?> 
